<!--
 * @FilePath     : /study_code/vue2.x/transition-group1.html
 * @Description  : 列表随机排序过渡
 * @Date         : 2025-05-03 08:36:09
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-05-03 08:36:21
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <style>
      .flip-list-move {
        transition: transform 1s;
      }
    </style>
  </head>
  <body>
    <div id="app" class="demo">
      <button v-on:click="shuffle">Shuffle</button>
      <transition-group name="flip-list" tag="ul">
        <li v-for="item in items" v-bind:key="item">{{ item }}</li>
      </transition-group>
    </div>

    <script src="/vue/dist/vue.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.14.1/lodash.min.js"></script>
    <script src="./common.js"></script>
    <script>
      // 自定义组件
      const myComponent = {
        data: function () {
          return {}
        },
        props: [],
        template: ``,
        methods: {},
      }

      var app = new Vue({
        el: '#app',
        data: function () {
          return {
            items: [1, 2, 3, 4, 5, 6, 7, 8, 9],
          }
        },
        methods: {
          /**
           * @brief: 创建一个打乱值的集合
           * @return {*}
           */
          shuffle: function () {
            this.items = _.shuffle(this.items)
          },
        },
      })
      /*
      内部的实现，Vue 使用了一个叫 FLIP 简单的动画队列
  使用 transforms 将元素从之前的位置平滑过渡新的位置。
      */
    </script>
  </body>
</html>
